fix: Print stderr for list-all / latest-stable callbacks#2154
Closed
CGA1123 wants to merge 3 commits into
Closed
Conversation
This updates usages of `list-all` and `latest-stable` plugin callbacks to dump their stderr to `asdf`'s stderr, so that plugins can provide more context around why plugin installation may fail.
There was a problem hiding this comment.
Pull request overview
This PR updates the version-resolution path to forward plugin callback stderr (latest-stable and list-all) to asdf’s stderr, making failures during “latest” resolution easier to diagnose.
Changes:
- Updated
versions.Latest/versions.AllVersionsAPIs to accept anio.Writerfor stderr and wire it through toPlugin.RunCallback. - Updated CLI call sites to pass stderr through when resolving “latest”.
- Extended tests to validate that
list-allcallback stderr is captured when the callback fails.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/versions/versions.go | Threads a provided stderr writer into latest-stable/list-all callback execution. |
| internal/versions/versions_test.go | Updates call sites for new signatures and adds coverage for propagating callback stderr on failure. |
| internal/cli/set/set.go | Updates set command’s “latest” resolution to call the new versions.Latest signature. |
| internal/cli/cli.go | Updates latest command flow to pass stderr into versions.Latest via latestForPlugin. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
41
to
44
| if parsedVersion.Type == "latest" { | ||
| plugin := plugins.New(conf, args[0]) | ||
| resolvedVersion, err := versions.Latest(plugin, parsedVersion.Value) | ||
| resolvedVersion, err := versions.Latest(plugin, parsedVersion.Value, os.Stderr) | ||
| if err != nil { |
Comment on lines
+1582
to
1586
| func latestForPlugin(conf config.Config, toolName, pattern string, showStatus bool, errOut io.Writer) error { | ||
| // show single plugin | ||
| plugin := plugins.New(conf, toolName) | ||
| latest, err := versions.Latest(plugin, pattern) | ||
| latest, err := versions.Latest(plugin, pattern, errOut) | ||
| if err != nil && err.Error() != "no latest version found" { |
Member
|
Thanks for the PR @CGA1123 ! I made a small update to these changes and then merged them. They will go out in the next release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This updates usages of
list-allandlatest-stableplugin callbacks to dump their stderr toasdf's stderr, so that plugins can provide more context around why plugin installation may have failed during version resolution.